<?php 
session_start();
if ($_SESSION['auth'] != true && $_SESSION['rule'] != "ADMIN") {
	die('Not log in');
}
include("includes/adminController.php");

switch($_GET['action']){

case "add_provider":
	addProvider($_POST['username'],$_POST['password'],$_POST['fname'],$_POST['lname']
	,$_POST['company'],$_POST['chIdArray']);
	echo "Added";
	break;

case "add_publisher":
	addPublisher($_POST['username'],$_POST['password'],$_POST['fname'],$_POST['lname']
	,$_POST['company'],$_POST['chIdArray']);
	echo "Added";
	break;

case "add_channel":
	addChannel($_POST['title'],$_POST['link'],$_POST['description'],$_POST['pubdate'],
			$_POST['language'],$_POST['lastbuilddate'],$_POST['docs'],$_POST['generator']
			,$_POST['managingeditor'],$_POST['webmaster'],$_POST['ttl'],$_POST['rank']);
	echo "Added";
	break;
	
case "add_reader":
	addReader($_POST['username'],$_POST['password'],$_POST['fname'],$_POST['lname']
		,$_POST['company'],$_POST['rank']);
	echo "Added";
	break;
	
case "edit_channel":
	editChannel($_POST['id'],$_POST['title'],$_POST['link'],$_POST['description'],$_POST['pubdate']
			,$_POST['language'],$_POST['lastbuilddate'],$_POST['docs'],$_POST['generator']
			,$_POST['managingeditor'],$_POST['webmaster'],$_POST['ttl'],$_POST['rank']);
	echo "Edited";
	break;
	
case "edit_reader":
	editReader($_POST['username'],$_POST['password'],$_POST['fname'],$_POST['lname']
			,$_POST['company'],$_POST['rank']);
	echo "Edited";
	break;
	
case  "edit_provider":
	editProvider($_POST['username'],$_POST['password'],$_POST['fname'],$_POST['lname']
			,$_POST['company'],$_POST['chIdArray']);
	echo "Edited";
	break;

	

case  "edit_publisher":
	editPublisher($_POST['username'],$_POST['password'],$_POST['fname'],$_POST['lname']
			,$_POST['company'],$_POST['chIdArray']);
	echo "Edited";
	break;

case  "delete_channel":

	deleteChannel($_POST['id']);

	echo "Deleted";

	break;

default:
	echo "Oh shit";
	break;
}
?>